Optimal. Leaf size=102 \[ \frac {a x^3}{3}-\frac {b x \cos \left (c+d x^2\right )}{2 d}+\frac {b \sqrt {\frac {\pi }{2}} \cos (c) C\left (\sqrt {d} \sqrt {\frac {2}{\pi }} x\right )}{2 d^{3/2}}-\frac {b \sqrt {\frac {\pi }{2}} S\left (\sqrt {d} \sqrt {\frac {2}{\pi }} x\right ) \sin (c)}{2 d^{3/2}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.05, antiderivative size = 102, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 5, integrand size = 16, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.312, Rules used = {14, 3466, 3435,
3433, 3432} \begin {gather*} \frac {a x^3}{3}+\frac {\sqrt {\frac {\pi }{2}} b \cos (c) \text {FresnelC}\left (\sqrt {\frac {2}{\pi }} \sqrt {d} x\right )}{2 d^{3/2}}-\frac {\sqrt {\frac {\pi }{2}} b \sin (c) S\left (\sqrt {d} \sqrt {\frac {2}{\pi }} x\right )}{2 d^{3/2}}-\frac {b x \cos \left (c+d x^2\right )}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 14
Rule 3432
Rule 3433
Rule 3435
Rule 3466
Rubi steps
\begin {align*} \int x^2 \left (a+b \sin \left (c+d x^2\right )\right ) \, dx &=\int \left (a x^2+b x^2 \sin \left (c+d x^2\right )\right ) \, dx\\ &=\frac {a x^3}{3}+b \int x^2 \sin \left (c+d x^2\right ) \, dx\\ &=\frac {a x^3}{3}-\frac {b x \cos \left (c+d x^2\right )}{2 d}+\frac {b \int \cos \left (c+d x^2\right ) \, dx}{2 d}\\ &=\frac {a x^3}{3}-\frac {b x \cos \left (c+d x^2\right )}{2 d}+\frac {(b \cos (c)) \int \cos \left (d x^2\right ) \, dx}{2 d}-\frac {(b \sin (c)) \int \sin \left (d x^2\right ) \, dx}{2 d}\\ &=\frac {a x^3}{3}-\frac {b x \cos \left (c+d x^2\right )}{2 d}+\frac {b \sqrt {\frac {\pi }{2}} \cos (c) C\left (\sqrt {d} \sqrt {\frac {2}{\pi }} x\right )}{2 d^{3/2}}-\frac {b \sqrt {\frac {\pi }{2}} S\left (\sqrt {d} \sqrt {\frac {2}{\pi }} x\right ) \sin (c)}{2 d^{3/2}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.13, size = 104, normalized size = 1.02 \begin {gather*} \frac {a x^3}{3}-\frac {b x \cos (c) \cos \left (d x^2\right )}{2 d}+\frac {b \sqrt {\frac {\pi }{2}} \left (\cos (c) C\left (\sqrt {d} \sqrt {\frac {2}{\pi }} x\right )-S\left (\sqrt {d} \sqrt {\frac {2}{\pi }} x\right ) \sin (c)\right )}{2 d^{3/2}}+\frac {b x \sin (c) \sin \left (d x^2\right )}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.04, size = 68, normalized size = 0.67
method | result | size |
default | \(\frac {a \,x^{3}}{3}+b \left (-\frac {x \cos \left (d \,x^{2}+c \right )}{2 d}+\frac {\sqrt {2}\, \sqrt {\pi }\, \left (\cos \left (c \right ) \FresnelC \left (\frac {x \sqrt {d}\, \sqrt {2}}{\sqrt {\pi }}\right )-\sin \left (c \right ) \mathrm {S}\left (\frac {x \sqrt {d}\, \sqrt {2}}{\sqrt {\pi }}\right )\right )}{4 d^{\frac {3}{2}}}\right )\) | \(68\) |
risch | \(\frac {b \sqrt {\pi }\, \erf \left (\sqrt {-i d}\, x \right ) {\mathrm e}^{i c}}{8 d \sqrt {-i d}}+\frac {b \sqrt {\pi }\, \erf \left (\sqrt {i d}\, x \right ) {\mathrm e}^{-i c}}{8 d \sqrt {i d}}+\frac {a \,x^{3}}{3}-\frac {b x \cos \left (d \,x^{2}+c \right )}{2 d}\) | \(81\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [C] Result contains complex when optimal does not.
time = 0.31, size = 75, normalized size = 0.74 \begin {gather*} \frac {1}{3} \, a x^{3} - \frac {{\left (8 \, d^{2} x \cos \left (d x^{2} + c\right ) + \sqrt {2} \sqrt {\pi } {\left ({\left (\left (i - 1\right ) \, \cos \left (c\right ) + \left (i + 1\right ) \, \sin \left (c\right )\right )} \operatorname {erf}\left (\sqrt {i \, d} x\right ) + {\left (-\left (i + 1\right ) \, \cos \left (c\right ) - \left (i - 1\right ) \, \sin \left (c\right )\right )} \operatorname {erf}\left (\sqrt {-i \, d} x\right )\right )} d^{\frac {3}{2}}\right )} b}{16 \, d^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.39, size = 86, normalized size = 0.84 \begin {gather*} \frac {4 \, a d^{2} x^{3} + 3 \, \sqrt {2} \pi b \sqrt {\frac {d}{\pi }} \cos \left (c\right ) \operatorname {C}\left (\sqrt {2} x \sqrt {\frac {d}{\pi }}\right ) - 3 \, \sqrt {2} \pi b \sqrt {\frac {d}{\pi }} \operatorname {S}\left (\sqrt {2} x \sqrt {\frac {d}{\pi }}\right ) \sin \left (c\right ) - 6 \, b d x \cos \left (d x^{2} + c\right )}{12 \, d^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 223 vs.
\(2 (102) = 204\).
time = 1.87, size = 223, normalized size = 2.19 \begin {gather*} \frac {a x^{3}}{3} - \frac {b d^{\frac {3}{2}} x^{5} \sqrt {\frac {1}{d}} \cos {\left (c \right )} \Gamma \left (\frac {3}{4}\right ) \Gamma \left (\frac {5}{4}\right ) {{}_{2}F_{3}\left (\begin {matrix} \frac {3}{4}, \frac {5}{4} \\ \frac {3}{2}, \frac {7}{4}, \frac {9}{4} \end {matrix}\middle | {- \frac {d^{2} x^{4}}{4}} \right )}}{8 \Gamma \left (\frac {7}{4}\right ) \Gamma \left (\frac {9}{4}\right )} - \frac {b \sqrt {d} x^{3} \sqrt {\frac {1}{d}} \sin {\left (c \right )} \Gamma \left (\frac {1}{4}\right ) \Gamma \left (\frac {3}{4}\right ) {{}_{2}F_{3}\left (\begin {matrix} \frac {1}{4}, \frac {3}{4} \\ \frac {1}{2}, \frac {5}{4}, \frac {7}{4} \end {matrix}\middle | {- \frac {d^{2} x^{4}}{4}} \right )}}{8 \Gamma \left (\frac {5}{4}\right ) \Gamma \left (\frac {7}{4}\right )} + \frac {\sqrt {2} \sqrt {\pi } b x^{2} \sqrt {\frac {1}{d}} \sin {\left (c \right )} C\left (\frac {\sqrt {2} \sqrt {d} x}{\sqrt {\pi }}\right )}{2} + \frac {\sqrt {2} \sqrt {\pi } b x^{2} \sqrt {\frac {1}{d}} \cos {\left (c \right )} S\left (\frac {\sqrt {2} \sqrt {d} x}{\sqrt {\pi }}\right )}{2} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [C] Result contains complex when optimal does not.
time = 3.64, size = 145, normalized size = 1.42 \begin {gather*} \frac {1}{3} \, a x^{3} - \frac {b x e^{\left (i \, d x^{2} + i \, c\right )}}{4 \, d} - \frac {b x e^{\left (-i \, d x^{2} - i \, c\right )}}{4 \, d} - \frac {\sqrt {2} \sqrt {\pi } b \operatorname {erf}\left (-\frac {1}{2} \, \sqrt {2} x {\left (-\frac {i \, d}{{\left | d \right |}} + 1\right )} \sqrt {{\left | d \right |}}\right ) e^{\left (i \, c\right )}}{8 \, d {\left (-\frac {i \, d}{{\left | d \right |}} + 1\right )} \sqrt {{\left | d \right |}}} - \frac {\sqrt {2} \sqrt {\pi } b \operatorname {erf}\left (-\frac {1}{2} \, \sqrt {2} x {\left (\frac {i \, d}{{\left | d \right |}} + 1\right )} \sqrt {{\left | d \right |}}\right ) e^{\left (-i \, c\right )}}{8 \, d {\left (\frac {i \, d}{{\left | d \right |}} + 1\right )} \sqrt {{\left | d \right |}}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int x^2\,\left (a+b\,\sin \left (d\,x^2+c\right )\right ) \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________